import pygame, os, sys, math
from pygame.locals import *
pygame.init()

#From https://code.google.com/p/pong-drew-liam-nate/source/browse/Scoreboard.py

class ScoreBoard():
    def __init__(self, pos = (0,0)):
        self.baseimage = pygame.image.load("Resources/scoreboard.png")
        self.image = self.baseimage.copy()
        self.rect = self.image.get_rect()
        self.place(pos)
        self.glassScore = 0
        self.missGlassScore = 0
        font = pygame.font.Font(None, 48)
        gtext = font.render(str(self.glassScore), 1, (255, 50, 0))
        gtextpos = (35,75)
        self.image.blit(gtext, gtextpos)
        mtext = font.render(str(self.missGlassScore), 1, (255, 50, 0))
        mtextpos = (150,75)
        self.image.blit(mtext, mtextpos)

    def scoreInGlass(self):
        self.glassScore += 1
        font = pygame.font.Font(None, 48)
        self.image = self.baseimage.copy()
        gtext = font.render(str(self.glassScore), 1, (255, 50, 0))
        gtextpos = (35,75)
        self.image.blit(gtext, gtextpos)
        mtext = font.render(str(self.missGlassScore), 1, (255, 50, 0))
        mtextpos = (150,75)
        self.image.blit(mtext, mtextpos)  

    def scoreOutGlass(self):
        self.missGlassScore += 1
        font = pygame.font.Font(None, 48)
        self.image = self.baseimage.copy()
        gtext = font.render(str(self.glassScore), 1, (255, 50, 0))
        gtextpos = (35,75)
        self.image.blit(gtext, gtextpos)
        mtext = font.render(str(self.missGlassScore), 1, (255, 50, 0))
        mtextpos = (150,75)
        self.image.blit(mtext, mtextpos) 
     
    def place(self, pt):
        self.rect.center = pt
